﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VastPark.Acquisition.Model;

namespace ImmlPad.UpdateManagement
{
    public class UpdateResource : IResource
    {
        private double _Progress;

        public double Progress
        {
            get
            {
                return _Progress;
            }
            set
            {
                if (_Progress == value)
                {
                    return;
                }

                _Progress = value;
                
                this.ProgressAction((float)_Progress);
            }
        }

        public double TransferRate { get; private set; }

        public long BytesTransferred { get; set; }

        public DateTime TransferStarted { get; set; }

        public long ContentLength { get; set; }

        public string ContentEncoding { get; set; }

        public string Uri { get; private set; }

        public Action<float> ProgressAction { get; private set; }

        public UpdateResource(string uri, Action<float> progressAction)
        {
            this.Uri = uri;
            this.ProgressAction = progressAction;
        }
    }

}
